package com.springboot3.test.springboot3testdemo4.demos.web.config;

import java.util.Collections;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.zalando.logbook.spring.LogbookClientHttpRequestInterceptor;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： liuziyang
 * @date： 2024/9/12-10:09
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
@Configuration
public class RestTemplateConfig {
  @Bean
  RestTemplate logbookRestTemplate(LogbookClientHttpRequestInterceptor interceptor) {
    RestTemplate restTemplate = new RestTemplate();
    restTemplate.setInterceptors(Collections.singletonList(interceptor));
    return restTemplate;
  }
}
